package com.hc.controller.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Locale;

/**
 * 自定义的一个扩展mvc功能的类
 * @author hs
 * @date 2021/05/03
 */
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {

    @Bean
    public ViewResolver getMyViewResolver(){
        return new MyViewResolver();
    }

    /**
     * 实现了ViewResolver接口的类就是一个视图解析器
     * 我们自己定义了一个视图解析器，然后通过上面的@Bean注解将这个放入容器中
     */
    public static class MyViewResolver implements ViewResolver{
        @Override
        public View resolveViewName(String s, Locale locale) throws Exception {
            return null;
        }
    }
}
